package okl.test.motionChart.parts
{
	import com.fizzback.utils.ColorsHelper;
	
	import flash.display.DisplayObject;
	import flash.display.GradientType;
	import flash.display.Sprite;
	import flash.geom.Matrix;
	
	import mx.core.UIComponent;
	import mx.graphics.GradientBase;
	import mx.graphics.GradientEntry;
	import mx.graphics.GradientStroke;
	import mx.graphics.LinearGradient;
	import mx.utils.ColorUtil;
	
	import spark.effects.Resize;
	
	/**
	 *	@author "oleksandr.kulinchenko@gmail.com"
	 */
	public class ChartLineMask extends UIComponent
	{
		public function ChartLineMask()
		{
			super();		
		
		}
		
		private var _gradient:GradientBase;
		/**
		 * Used for data mapping purposes
		 */
		public var data:Object;

		/**
		 * Background color gradients 
		*/
		public function get gradient():GradientBase
		{
			return _gradient;
		}

		public function set gradient(value:GradientBase):void
		{
			_gradient = value;
			invalidateDisplayList();
		}

		override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void{
			super.updateDisplayList(unscaledWidth, unscaledHeight);
			this.graphics.clear();
			if(gradient==null)return;
			var matrix:Matrix= new Matrix();
			matrix.createGradientBox(unscaledWidth, unscaledHeight, (Math.PI/180)*90, 0, 0);
			ColorsHelper.beginGradientFill(this.graphics, gradient, matrix);			
			this.graphics.drawRect(0, 0, unscaledWidth, unscaledHeight);
			this.graphics.endFill();
		}
	}
}